GetFromFile {Time History}

GetFromFile 
(Note: Newer function available)

Syntax

SapObject.SapModel.Func.FuncTH.GetFromFile

VB6 Procedure

Function GetFromFile(ByVal Name As String, ByRef FileName As String, ByRef HeadLines As Long, ByRef PreChars As Long, ByRef PointsPerLine As Long, ByRef ValueType As Long, ByRef FreeFormat As Boolean, ByRef NumberFixed As Long) As Long

Parameters

Name

The name of a defined time history function specified to be from a text file.

FileName

The full path of the text file containing the function data.

HeadLines

The number of header lines in the text file to be skipped before starting to read function data.

PreChars

The number of prefix characters to be skipped on each line in the text file.

PointsPerLine

The number of function points included on each text file line.

ValueType

This is either 1 or 2, indicating value type.

1 = Values at equal time intervals

2 = Time and function values

FreeFormat

This item is True if the data is provided in a free format. It is False if it is in a fixed format.

NumberFixed

This item applies only when the FreeFormat item is False. It is the number of characters per item.

Remarks

This function retrieves the definition of a time history function from file.

The function returns zero if the function definition is successfully retrieved; otherwise it returns a nonzero value.

VBA Example

Sub GetTHFuncFromFile()

'dimension variables

Dim SapObject As Sap2000v15.SapObject

Dim SapModel As cSapModel

Dim ret As Long

Dim FileName As String

Dim HeadLines As Long

Dim PreChars As Long

Dim PointsPerLine As Long

Dim ValueType As Long

Dim FreeFormat As Boolean

Dim NumberFixed As Long

'create Sap2000 object

Set SapObject = New Sap2000v15.SapObject

'start Sap2000 application

SapObject.ApplicationStart

'create SapModel object

Set SapModel = SapObject.SapModel

'initialize model

ret = SapModel.InitializeNewModel

'create model from template

ret = SapModel.File.New2DFrame(PortalFrame, 2, 144, 2, 288)

'add TH function from file

ret = SapModel.Func.FuncTH.SetFromFile("TH-1", "C:\SapAPI\FuncTH.txt", 3, 0, 3, 2, True)

'get TH function from file

ret = SapModel.Func.FuncTH.GetFromFile("TH-1", FileName, HeadLines, PreChars, PointsPerLine, ValueType, FreeFormat, NumberFixed)

'close Sap2000

SapObject.ApplicationExit False

Set SapModel = Nothing

Set SapObject = Nothing

End Sub

Text File

Following is the contents of the text file name FuncTH.txt used in the VBA Example.

Time History Function

Time (sec) and Acceleration (g) values

3 points per line

0.00000.01080.04200.00100.09700.01590

.16100-.00010.22100.01890.26300.00010

.29100.00590.33200-.00120.37400.02000

.42900-.02370.47100.00760.58100.04250

.62300.00940.66500.01380.72000-.00880

.72010-.02560.78900-.03870.78910-.05680

.87200-.02320.87210-.03430.94100-.04020

.94110-.06030.99700-.078901.06600-.06660

1.06610-.038101.09400-.042901.16800.08970

1.31500-.169601.38400-.082801.41200-.08280

1.44000-.094501.48100-.088501.50900-.10800

1.53700-.128001.62800.114401.70300.23550

1.80000.142801.85500.177701.92400-.26100

2.00700-.319402.21500.295202.27000.26340

2.32000-.298402.39500.005402.45000.28650

2.51900-.046902.57500.151602.65200.20770

2.70800.108702.76900-.032502.89300.10330

2.97600-.080303.06800.052003.12900-.15470

3.21200.006503.25300-.206003.38600.19270

3.41900-.093703.53000.170803.59900-.03590

3.66800.036503.73800-.073603.83500.03110

3.90400-.183304.01400.022704.05600-.04350

4.10600.021604.22200-.197204.31400-.17620

4.41600.146004.47100-.004704.61800.25720

4.66500-.204504.75600.060804.83100-.27330

4.97000.177905.03900.030105.10800.21830

5.19900.026705.23300.125205.30200.12900

5.33000.108905.34300-.023905.45400.17230

5.51000-.102105.60600.014105.69000-.19490

5.77300-.024205.80000-.005005.80900-.02750

5.86900-.057305.88300-.032705.92500.02160

5.98000.010806.01300.023506.08500-.06650

6.13200.001406.17400.049306.18800.01490

6.18810-.020006.22900-.038106.27900.02070

6.32600-.005806.36800-.060306.38200-.01620

6.40900.020006.45900-.017606.47800-.00330

6.52000.004306.53400-.004006.56200-.00990

6.57500-.001706.60300-.017006.64500.03730

6.68600.045706.71400.038506.72800.00090

6.76900-.028806.76910.001606.81100.01130

6.85200.002206.90800.009206.99100-.09960

7.07400.036007.12100.007807.14300-.02770

7.14900.002607.17100.027207.22600.05760

7.29500-.049207.37000.029707.40600.01090

7.42500.018607.46100-.025307.52500-.03470

7.57200.003607.60000-.062807.64100-.02800

7.66900-.019607.69100.006807.75200-.00540

7.79400-.060307.83500-.035707.87700-.07160

7.96000-.014007.98700-.005608.00100.02220

8.07000.046808.12600.026008.12610-.03350

8.19500-.012808.22300.066108.27800.03050

8.33400.024608.40300.034708.45800-.03690

8.53300 -.034408.59600-.010408.63800-.02600

8.73500.153408.81800-.002808.86000.02330

8.88200-.026108.91500-.002208.95600-.18490

9.05300.126009.09500.032009.12300.09550

9.15000.124609.25300-.032809.28900-.04510

9.42700.130109.44100-.165709.51000.04190

9.63500-.093609.70400.081609.81500-.08810

9.89800.006409.93900-.000609.99500.05860

10.02200-.0713010.05000-.0448010.05010-.02210

10.10500.0093010.10510.0024010.18800.05100

10.27200-.1243010.38200.0587010.42400.01330

10.45200.0386010.46500.1164010.50700-.03740

10.53400-.0572010.64500.0308010.70100.02230

10.71400.0515010.77000.0903010.83900-.01940

10.92200.0471010.92210-.0677010.96400-.07940

10.99100-.0120011.07400.0608011.08800-.02690

11.11600-.0416011.20700.0293011.20710.05520

11.22700.0756011.26800.0431011.32400.02080

11.43400.1180011.57300-.0999011.65600-.12470

11.72500-.2094011.72510-.1418011.78000-.11630

11.808000.0000011.87700.0762011.91900.05700

11.98800.1354012.04300.0673012.11300.08650

Release Notes

Initial release in version 11.02.

The function is obsolete and has been superseded by 
GetFromFile_1
 as of version 14.12. This function is maintained for backward compatibility. New function added.

See Also

SetFromFile